import $service from '../../../../../service.js';
var notice_id;
var user_type = "1";
var user_id;
Page({
    data:{
       noticeMap:{
           "notice_title" : 11,
           "notice_content" : 111,
           "lrsj" : '11'
       },
       notice_type:'',
       prescriptionMap:{},
       prescriptionList:[],
       inquiryMap:{}
    },
    onLoad(e) {
        notice_id = e.notice_id;
        this.setData({
            notice_type : e.notice_type
        })
    },
    onShow() {
        if(!$service.isUndefinedAndEmpty($service.getUserLocalStorage().user_type)){
        		user_type = $service.getUserLocalStorage().user_type;
        	}
         if(user_type == 1){//1用户 1门店
             user_id = $service.getUserLocalStorage().user_id;
         }else{
             user_id = $service.getUserLocalStorage().store_id;
         }
         this.publicUtil_getNoticeDetails()
    },
    publicUtil_getNoticeDetails:function(){
        var jsonData ={
            "notice_id" : notice_id
        }
        var jsonAjax = {
            "url": "publicUtil_getNoticeDetails.do",
            "jsonData": jsonData,
        }
        $service.getAjaxData(jsonAjax, this.publicUtil_getNoticeDetails_back);
    },
    publicUtil_getNoticeDetails_back:function(jsonBack){
        var data=$service.strToJson(jsonBack.data).data; 
        var noticeMap = data.noticeMap;
        if(this.data.notice_type == 2){
            this.data.prescriptionMap = data.prescriptionMap;
            this.data.prescriptionList =  this.data.prescriptionMap.prescriptionList;
            this.data.inquiryMap = data.inquiryMap;
        }
        this.setData({
            noticeMap : noticeMap,
            prescriptionMap : this.data.prescriptionMap,
            prescriptionList : this.data.prescriptionList,
            inquiryMap : this.data.inquiryMap
        })
    }
})